--
--
--
--

VRAI = 1
FAUX = 2
PEUTETRE = 3

function readLine(file)
   line = file:read("*line")
   if line == nil then return nil end
   local res = string.split(line, ":")
   return res
end

function checkFuncProto(text)
   if text ~= nil and (isFuncProto(text)) then
      local res = string.find(text, '\t')
      if res == nil then return VRAI end
      return FAUX
   end
   return PEUTETRE
end

function checkInclude(text)
   if text ~= nil and text:starts("#include") then
      return VRAI
   end
   return PEUTETRE
end

function checkDefine(text)
   if text ~= nil and text:starts("#define") then
      return VRAI
   end
   return PEUTETRE
end

function checkStruct(text)
   if text ~= nil and text:starts("struct") or text:starts("typedef") then
      return VRAI
   end
   return PEUTETRE
end

function checkIF(text)
   if text ~= nil and text:starts("#ifndef") then
      return VRAI
   end
   return PEUTETRE
end

function checkDiff(diff)
   for i,v in ipairs(diff) do
      for k,l in ipairs(v.i) do
	 LINE = l.l
	 if l.t == nil then 
	    if BLANK == 1 then
	       warnFile(l.f, "j;To much new lines!.")
	    else
	       BLANK = 1
	    end
	 else
	    BLANK = nil
	 end
	 if l.t == nil or VRAI == checkFuncProto(l.t) or VRAI == checkInclude(l.t) or VRAI == checkIF(l.t) or  VRAI == checkDefine(l.t) or  VRAI == checkStruct(l.t) then

	 elseif FAUX == checkFuncProto(l.t) or FAUX == checkIF(l.t) or FAUX == checkInclude(l.t) or FAUX == checkDefine(l.t) or  FAUX == checkStruct(l.t) then

	 else
	    warnFile(l.f, "S;Space or indentation problem.")
	 end
      end
   end
end
